package com.slz3.business.module.messageManagement.mesCreate.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesCreate.domain.MesCreate;
import com.slz3.business.module.messageManagement.mesCreate.domain.MesCreateFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesCreateTransactionalServiceImpl implements MesCreateTransactionalService {

    @Override
    public MesCreate modify(MesCreate mesCreateNew) {
        Repositorys.mesCreate.test();
        Repositorys.mesCreate.save(MesCreateFactory.initBaseFields());
        System.err.println(1/0);
        mesCreateNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesCreate.saveAndFlush(mesCreateNew);
    }

    @Override
    public List<MesCreate> batchModify(List<MesCreate> mesCreateList) {
        return Repositorys.mesCreate.saveAll(mesCreateList);
    }
}
